/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package rentcalculator.model;

import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;

/**
 *
 * @author K.E.Y
 */

@Entity
public class Person {

    
    public Person(){
        this.absentBillable = false;
        this.billDiscounts = new ArrayList<>();
        
    }
    
    
    public Person(String name) {
        this.absentBillable = false;
        this.name = name;
        this.billDiscounts = new ArrayList<>();
        
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Discount> getBillOffsets() {
        return billDiscounts;
    }

    public void setBillOffsets(List<Discount> billDiscounts) {
        this.billDiscounts = billDiscounts;
    }
    
    @Id
    @GeneratedValue(strategy = IDENTITY)
    private long id;
    private String name;
    
    @OneToMany(fetch = FetchType.EAGER)
    private List<Discount> billDiscounts;
    
    @Column(name="absent_billable")
    private boolean absentBillable;
}
